package com.stylefeng.guns.core.util;


import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;

import org.json.JSONObject;


public class StringOperationUtils {

	/**
	 * 
	 * <B>方法描述：</B>（将附件json字符串转换成map） <br/>
	 * @param jsonStr
	 */
	@SuppressWarnings("unchecked")
	public static Map<String,String> dealWithJsonStrToMap(String jsonStr){
		Map<String,String> imgValMap = new HashMap<String, String>();
		if (ToolUtil.isEmpty(jsonStr)) {
			return null;
		}
		JSONObject jsonObject = new JSONObject(jsonStr);
		Iterator ite = jsonObject.keys();
		while (ite.hasNext()) {
			String key = ite.next().toString();
			String urlStr = jsonObject.get(key).toString().replace("\\", "/");
			imgValMap.put(key, urlStr);
		}
		return imgValMap;
	}
}
